<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!-- 全局css引入 必须 -->
<link href="<%=basePath%>/style/style.css" rel="stylesheet" type="text/css">
<link href="<%=basePath%>/style/global.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=basePath%>/js/global.js"></script>
<!-- prototype1.5 版本与验证框架兼容 -->
<script type="text/javascript" src="<%=basePath%>/js/prototype.js"></script>
<!-- 结束 -->
<!-- 用到表单验证必须引入 -->
<jsp:include page="/vailidateInclude.jsp" />
<!-- 结束 -->
<!--<jsp:include page="/extInclude.jsp" /> 如用到ext必须引入 -->
<style>
.changedField {
	background-color: aqua;
	font-style: italic;
}
</style>
<script type="text/javascript">
//为表单每个field注册change事件
window.onload = function() {
    Event.observe('infoForm', 'submit', submitMe);
    Form.getElements('infoForm').each(
    	function(element) {
        	Event.observe($(element), 'change', markChanged);
    	}
	);
}
//变动操作
function markChanged(event) {
	var obj=Event.element(event);
//如果有改变则加上changedField样式，否则移除changedField样式
	if(obj.defaultValue!=obj.value){
 		obj.addClassName('changedField');
	}else{
 		obj.removeClassName('changedField');
	}
}

//表单提交
function submitMe(event) {
    var changedElements = $$('.changedField');
    var faildElements=$$('.validation-failed');
    if(faildElements.length>0){
    	  alert("请检查数据是否正确！");
    	  return;
    }
    if (changedElements.length > 0) {
        var parameters = {};
        changedElements.each(
        	function(element) {
        		//alert(element.name);
            	parameters[element.name] = element.value;
            	element.removeClassName('changedField');
        	}
     	);
     //alert(parameters['map.ygbgdh'])
	}
}
</script>
<div class="rightCon" align="center">
	<div class="rightTitle2">
		<h3>
			<s:property value="nav" escape="false" />
		</h3>
	</div>
	<s:form action="myInfo.do" id="infoForm" method="post" cssClass="required-validate">
		<table class="formTable">
			<colgroup>
				<col class="formLabel" align="left" width="25%">
				<col align="left" />
			</colgroup>
			<tr>
				<td width="35%" align="right">
					所属部门：
				</td>
				<td width="65%" align="left">
					<s:hidden name="dept.id" />
					<s:hidden name="map.bmid" id='deptid' />
					<s:textfield name="map.deptname" id='deptname' readonly="true" cssClass="required" size="50" />
				</td>
			</tr>
			<tr class="xgTr1">
				<td align="right">
					<div align="right">
						用户编号：
					</div>
				</td>
				<td width="65%" align="left">
					<s:hidden name="map.id" />
					<s:textfield name="map.ygzh" cssClass="required" size="50" readonly="true" />
				</td>
			</tr>
			<tr>
				<td width="35%" align="right">
					用户姓名：
				</td>
				<td width="65%" align="left">
					<s:textfield name="map.ygxm" cssClass="required" size="50" readonly="true" />
				</td>
			</tr>
			<tr>
				<td width="35%" align="right">
					身份证号码：
				</td>
				<td width="65%" align="left">
					<s:textfield name="map.ygsfz" cssClass="validate-id-number" size="50" readonly="true"  />
				</td>
			</tr>
			<tr class="xgTr1">
				<td width="35%" align="right">
					<div align="right">
						职务：
					</div>
				</td>
				<td width="65%" align="left">
					<s:textfield name="map.ygzw" cssClass="required" size="50" readonly="true" />
				</td>
			</tr>
			<tr>
				<td width="35%" align="right">
					手机：
				</td>
				<td width="65%" align="left">
					<s:textfield name="map.sjhm" cssClass="validate-integer" size="50" />
				</td>
			</tr>
			<tr class="xgTr1">
				<td width="35%" align="right">
					<div align="right">
						办公电话：
					</div>
				</td>
				<td width="65%" align="left">
					<s:textfield name="map.gddh" cssClass="validate-integer" size="50" />
				</td>
			</tr>
			<tr>
				<td width="35%" align="right">
					用户说明：
				</td>
				<td width="65%" align="left">
					<s:textarea name="map.bz1" cols="28" />
				</td>
			</tr>
		</table>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="maintb1">
			<tr>
				<td align="center" class="maintb1">
					<input type="submit" value="保 存" class="buttonOk" />
					&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="reset" value="重 置" class="buttonOk" />
					&nbsp;&nbsp;&nbsp;&nbsp;

				</td>
			</tr>
		</table>
	</s:form>
	<s:form action="myInfo.do?action=changepwd" method="post" cssClass="required-validate">
		<table class="formTable">
			<colgroup>
				<col class="formLabel" align="left" width="25%">
				<col align="left" />
			</colgroup>
			<tr>
				<td>
					原密码：
				</td>
				<td>
					<s:password name="oldmm" cssClass="validate-integer" cssClass="required" size="50" />
				</td>
			</tr>
			<tr>
				<td width="35%" align="right">
					<div align="right">
						新密码：
					</div>
				</td>
				<td>
					<s:password name="map.ygmm" size="50" id="password" value="" cssClass="required" />
				</td>
			</tr>
			<tr>
				<td>
					确认新密码：
				</td>
				<td>
					<s:password name="ygmm" size="50" cssClass="equals-password" />
				</td>
			</tr>
		</table>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="maintb1">
			<tr>
				<td align="center" class="maintb1">
					<input type="submit" class="buttonOk" value="修改密码" />
				</td>
			</tr>
		</table>
	</s:form>
</div>